from django import forms
from core.models.course_period import CoursePeriod


class CoursePeriodForm(forms.ModelForm):
    class Meta:
        model = CoursePeriod
        fields = ['name', 'start_time', 'duration']
        labels = {
            'name': '时间段名称',
            'start_time': '开始时间',
            'duration': '课程时长(分钟)'
        }
        widgets = {
            'name': forms.TextInput(attrs={'class': 'form-control'}),
            'start_time': forms.TimeInput(attrs={'class': 'form-control', 'type': 'time'}),
            'duration': forms.NumberInput(attrs={'class': 'form-control', 'min': 1})
        }